import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:travel/routes/index.dart';
import 'package:travel/screen/flutter_screenutil.dart';
import 'package:travel/utils/colors.dart';
import 'package:travel/utils/styles.dart';

class SafetyController extends GetxController {
  RxString mobile = '135*****038'.obs;
}

class SafetyView extends GetView<SafetyController> {
  const SafetyView({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(() => Scaffold(
          backgroundColor: ColorsUtils.parseColorFromHexString(ColorsUtils.colorF7f7),
          appBar: AppBar(
            automaticallyImplyLeading: true,
            leading: InkWell(
              onTap: () {
                Get.back();
              },
              child: Icon(
                Icons.arrow_back_ios,
                color: ColorsUtils.parseColorFromHexString(ColorsUtils.color3333),
                size: 20.w,
              ),
            ),
            leadingWidth: 40.w,
            title: Text(
              '账号与安全',
              style: StylesUtils.customTextStyle(
                  color: ColorsUtils.color3333, fontSize: 18.sp, fontWeight: FontWeight.bold),
            ),
          ),
          body: SingleChildScrollView(
            padding: EdgeInsets.all(20.w),
            child: Column(
              children: [
                Container(
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(top: 15.w, bottom: 10.w, left: 15.w),
                  child: Text(
                    '账号设置',
                    style:
                        StylesUtils.customTextStyle(color: ColorsUtils.color9999, fontSize: 13.sp),
                  ),
                ),
                Container(
                  height: 50.h,
                  padding: EdgeInsets.symmetric(horizontal: 15.w),
                  decoration:
                      BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.w)),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        '手机号',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color3333, fontSize: 16.sp),
                      ),
                      InkWell(
                          onTap: () {
                            Get.toNamed(RoutePath.accountMobile);
                          },
                          child: Text.rich(TextSpan(children: [
                            TextSpan(
                                text: '${controller.mobile.value} ',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color6666, fontSize: 15.sp)),
                            WidgetSpan(
                              alignment: PlaceholderAlignment.middle,
                              child: Icon(
                                Icons.arrow_forward_ios,
                                color: ColorsUtils.parseColorFromHexString(ColorsUtils.color9999),
                                size: 12.sp,
                              ),
                            )
                          ])))
                    ],
                  ),
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(top: 15.w, bottom: 10.w, left: 15.w),
                  child: Text(
                    '第三方账号',
                    style:
                        StylesUtils.customTextStyle(color: ColorsUtils.color9999, fontSize: 13.sp),
                  ),
                ),
                Container(
                  height: 50.h,
                  padding: EdgeInsets.symmetric(horizontal: 15.w),
                  decoration:
                      BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.w)),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        '微信号',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color3333, fontSize: 16.sp),
                      ),
                      InkWell(
                          onTap: () {},
                          child: Text.rich(TextSpan(children: [
                            TextSpan(
                                text: '未绑定 ',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color6666, fontSize: 15.sp)),
                            WidgetSpan(
                              alignment: PlaceholderAlignment.middle,
                              child: Icon(
                                Icons.arrow_forward_ios,
                                color: ColorsUtils.parseColorFromHexString(ColorsUtils.color9999),
                                size: 12.sp,
                              ),
                            )
                          ])))
                    ],
                  ),
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(top: 15.w, bottom: 10.w, left: 15.w),
                  child: Text(
                    '安全设置',
                    style:
                        StylesUtils.customTextStyle(color: ColorsUtils.color9999, fontSize: 13.sp),
                  ),
                ),
                Container(
                  padding: EdgeInsets.symmetric(horizontal: 15.w),
                  decoration:
                      BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.w)),
                  child: ListBody(
                    children: [
                      SizedBox(
                        height: 50.h,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              '登录密码',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color3333, fontSize: 16.sp),
                            ),
                            InkWell(
                                onTap: () {
                                  Get.toNamed(RoutePath.accountPassword);
                                },
                                child: Text.rich(TextSpan(children: [
                                  TextSpan(
                                      text: '未设置/修改 ',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.color6666, fontSize: 15.sp)),
                                  WidgetSpan(
                                    alignment: PlaceholderAlignment.middle,
                                    child: Icon(
                                      Icons.arrow_forward_ios,
                                      color: ColorsUtils.parseColorFromHexString(
                                          ColorsUtils.color9999),
                                      size: 12.sp,
                                    ),
                                  )
                                ])))
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50.h,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              '注销账号',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color3333, fontSize: 16.sp),
                            ),
                            InkWell(
                                onTap: () {},
                                child: Text.rich(TextSpan(children: [
                                  TextSpan(
                                      text: '请谨慎操作 ',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.color6666, fontSize: 15.sp)),
                                  WidgetSpan(
                                    alignment: PlaceholderAlignment.middle,
                                    child: Icon(
                                      Icons.arrow_forward_ios,
                                      color: ColorsUtils.parseColorFromHexString(
                                          ColorsUtils.color9999),
                                      size: 12.sp,
                                    ),
                                  )
                                ])))
                          ],
                        ),
                      ),
                    ],
                  ),
                )
              ],
            ),
          ),
        ));
  }
}
